import java.util.Hashtable;

public class PlayerController implements IPlayerController {
	private static final long serialVersionUID = 1L;
	private IPlayer player;
	private IHMPlayer window;
	private Hashtable<String,String> choices;
	
	public PlayerController(IPlayer player) {
		this.player = player;
		this.window = new IHMPlayer(this);
		this.choices = new Hashtable<String,String>();
		
		choices.put("Charger", "LoadedSequence");
		choices.put("Creer", "CreatedSequence");
	}
	
	/***
	 * Demande a l'IHM d'afficher la liste des modes possibles a l'utilisateur
	 * Demande ensuite au player de charger une sequence
	 */
	public void go() {		
		this.player.load(choices.get(window.chooseMode(choices)));
		window.setVisible(true);
	}
	
	/***
	 * Demande au player de jouer la sequence
	 */
	public void playClick() {
		player.start();
	}
	
	/***
	 * Demande au player de stopper la sequence
	 */
	public void stopClick() {
		player.stop();
	}

}
